package com.nbjtjc.safe.mapper.emg.handle;

import com.nbjtjc.safe.model.emg.handle.EmgHandlePublic;
import com.nbjtjc.util.MyMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Date;
import java.util.List;

@Mapper
public interface EmgHandlePublicMapper extends MyMapper<EmgHandlePublic> {

    List<EmgHandlePublic> search(@Param("handlePublic") EmgHandlePublic emgHandlePublic);

    @Select("<script>"+
            "select count(*) from" +
            " emg_handle_public where dept_id in " +
            " <foreach item='deptId' index='index' collection='deptIds'      open='(' separator=',' close=')'> " +
            "#{deptId}" +
            " </foreach> " +
            " and create_time <![CDATA[ >= ]]> #{startDate} and create_time <![CDATA[ <= ]]> #{endDate}"+
            "</script>")
    int selectHandlePublicCountByDeptIds(@Param("deptIds") List<Integer> deptIds, @Param("startDate") Date startDate
            , @Param("endDate") Date endDate);
}